﻿using System;
using System.IO;
using System.Reflection;

namespace YJKMenuAssist.Utility
{
	public class FileUtility
	{
		public static string GetAssemblyPath()
		{
			if (string.IsNullOrEmpty(FileUtility.sm_assemblyPath))
			{
				FileUtility.sm_assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			}
			return FileUtility.sm_assemblyPath;
		}

		public static string GetAssemblyFullName()
		{
			if (string.IsNullOrEmpty(FileUtility.sm_assemblyFullName))
			{
				FileUtility.sm_assemblyFullName = Assembly.GetExecutingAssembly().Location;
			}
			return FileUtility.sm_assemblyFullName;
		}

		public static string GetApplicationResourcesPath()
		{
			if (string.IsNullOrEmpty(FileUtility.sm_appResourcePath))
			{
				FileUtility.sm_appResourcePath = FileUtility.GetAssemblyPath() + "\\Resources\\";
			}
			return FileUtility.sm_appResourcePath;
		}

		public static string GetAppRootPath()
		{
			string location = Assembly.GetExecutingAssembly().Location;
			int length = location.LastIndexOf("\\");
			string text = location.Substring(0, length);
			length = text.LastIndexOf("\\");
			return text.Substring(0, length);
		}

		private static string sm_assemblyPath;

		private static string sm_assemblyFullName;

		private static string sm_appResourcePath;
	}
}
